//
// Created by wxd on 2025/8/19.
// 定义光球

#pragma once

#ifndef LIGHTSPHERE_H
#define LIGHTSPHERE_H

#include "Sphere.h"
#include "glm/glm.hpp"
#include <memory>
#include "../glFramework/shader/Shader.h"
#include <string>

class LightSphere {
public:

    LightSphere(float radius, const glm::vec3& center,
                const glm::vec3& color, bool isHideLightSource = false)
    : m_Radius(radius), m_Center(center), m_Color(color), m_IsHideLightSource(isHideLightSource) {

        m_Sphere = std::make_unique<Sphere>(radius, center, color);
    };

    void setShader(const std::string& vertexPath, const std::string& fragmentPath);
    void setHideLightSource(bool isHideLightSource);

    Shader& getShader() const;
    Sphere& getSphere() const;
    glm::vec3 getCenter() const;
    glm::vec3 getColor() const;

    void draw(const glm::mat4& model, const glm::mat4& view, const glm::mat4& proj);
    void destroy() const;

private:
    float m_Radius { 0.f };
    glm::vec3 m_Center { glm::vec3(0.f) };
    glm::vec3 m_Color { glm::vec3(1.f) };

    bool m_IsHideLightSource { false };  // 是否隐藏光源

    std::unique_ptr<Sphere> m_Sphere {};
    std::unique_ptr<Shader> m_Shader {};
};



#endif //LIGHTSPHERE_H
